import request from '@/utils/request'
const Qs = require('qs')

// 获取省市区
export function exportCityList(query) {
    return request({
        url: '/system/sysCityInfoController/getCityList',
        method: 'get',
        params: query
    })
}
// 根据系统当前用户获取省市列表
export function getCustomCityList(query) {
    return request({
        url: '/system/sysCityInfoController/getCityListByUser',
        method: 'get',
        params: query
    })
}

// 查询客户信息列表
export function listCustomer(query) {
    return request({
        url: '/system/customerInfoController/getCustomerInfoList',
        method: 'get',
        params: query
    })
}

// 查询客户信息详细
export function getCustomer(id) {
    return request({
        url: '/system/customerInfoController/getCustomerInfo?id=' + id,
        method: 'get'
    })
}

// 新增客户信息
export function addCustomer(data) {
    return request({
        url: '/system/customerInfoController/save',
        method: 'post',
        data: data
    })
}

// 修改客户信息
export function updateCustomer(data) {
    return request({
        url: '/system/customerInfoController/save',
        method: 'post',
        data: data
    })
}

// 删除客户信息
export function delCustomer(id) {
    return request({
        url: '/system/customerInfoController/deleteCustomerInfo?ids=' + id,
        method: 'post'
    })
}

// 启停用客户信息
export function qtCustomer(query) {
    return request({
        url: '/system/customerInfoController/openOrStopCustomerInfo',
        method: 'post',
        params: query
    })
}


// 测试身份证号码是否可用
export function idCardCustomer(id) {
    return request({
        url: '/system/customerInfoController/testCustomerIdCard?idCard=' + id,
        method: 'get',
    })
}

// 测试登陆名是否可用
export function loginNameCustomer(loginName) {
    return request({
        url: '/system/customerInfoController/testCustomerLoginName?loginName=' + loginName,
        method: 'get',
    })
}

// 测试电话号码是否可用
export function phoneCustomer(phone) {
    return request({
        url: '/system/customerInfoController/phone?idCard=' + phone,
        method: 'get',
    })
}
// 获取经理人列表
export function axios_managerList (query) {
    return request({
        url: '/system/customerInfoController/getManagerInfoList',
        method: 'get',
        params: query
    })
}
// 更改经理人
export function axios_updateManager (query) {
    return request({
        url: '/system/customerInfoController/updateCustomerManager',
        method: 'get',
        params: query
    })
}


/*****客户详情 ******/
// 保存客户产品项目详情信息
export function addCustomerProductInfo(data) {
    return request({
        url: '/system/customerInfoController/addCustomerProductInfo',
        method: 'post',
        data: data
    })
}
// 获取客户产品项目详情信息
export function getCustomerProductDetailInfo(cusId) {
    return request({
        url: '/system/customerInfoController/getCustomerProductDetailInfo?cusId=' + cusId,
        method: 'post'
    })
}

// 保存客户房屋信息
export function addCustomerHouseInfo(data) {
    return request({
        url: '/system/customerInfoController/addCustomerHouseInfo',
        method: 'post',
        data: data
    })
}

// 保存客户车辆信息
export function addCustomerCarInfo(data) {
    return request({
        url: '/system/customerInfoController/addCustomerCarInfo',
        method: 'post',
        data: data
    })
}
// 保存客户保单信息
export function addCustomerInsuranceInfo(data) {
    return request({
        url: '/system/customerInfoController/addCustomerInsuranceInfo',
        method: 'post',
        data: data
    })
}
// 删除客户房屋, 车辆, 保单信息
export function deleteCustomerAttachInfo(data) {
    return request({
        url: '/system/customerInfoController/deleteCustomerAttachInfo?id=' + data.id + '&type='+data.type,
        method: 'post',
    })
}

// 查看客户车辆列表明细项目信息
export function getCustomerCarDetailInfo(data) {
    return request({
        url: '/system/customerInfoController/getCustomerCarDetailInfo?carId=' + data, 
        method: 'post'
    })
}
// 查看客户车辆列表信息
export function getCustomerCarList(cusId) {
    return request({
        url: '/system/customerInfoController/getCustomerCarList?cusId=' + cusId,
        method: 'post',
    })
}
// 查看客户房屋列表明细项目信息
export function getCustomerHouseDetailInfo(data) {
    return request({
        url: '/system/customerInfoController/getCustomerHouseDetailInfo?houseId=' + data,
        method: 'post'
    })
}

// 查看客户房屋列表信息
export function getCustomerHouseList(cusId) {
    return request({
        url: '/system/customerInfoController/getCustomerHouseList?cusId=' + cusId,
        method: 'post'
    })
}

// 查看客户保单列表明细项目信息
export function getCustomerInsuranceDetailInfo(data) {
    return request({
        url: '/system/customerInfoController/getCustomerInsuranceDetailInfo?insuranceId=' + data,
        method: 'post'
    })
}
// 查看客户保单列表信息
export function getCustomerInsuranceList(cusId) {
    return request({
        url: '/system/customerInfoController/getCustomerInsuranceList?cusId=' + cusId,
        method: 'post'
    })
}
